﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>移交管理</title>
    <#include "../common/link.ftl"/>

    <script>
        $(function () {

            /*------------------------删除-------------------------------*/

            $(".btn-delete").click(function () {

                var $id = $(this).data("id");

                $.messager.confirm("温馨提示", "确定要删除吗？", function () {
                    $.get("/customerTransfer/delete", {id: $id}, handlerMessage);
                });
            });

            /*----------------------模态框---------------------------*/

            $(".btn-input").click(function () {
                $("#editForm input").val("");  //清空模态框数据
                var dept = $(this).data("dept"); //获取移交数据
                if (dept) {
                    $("#id").val(dept.id);          //回显数据
                    $("#name").val(dept.name);         //回显数据
                    $("#sn").val(dept.sn);         //回显数据
                }
                $('#input-modal').modal('show')     //显示模态框
            });

            $("#editForm").ajaxForm(handlerMessage);

        });

    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl"/>

    <!--菜单回显-->
    <#assign currentMenu="customerTransfer"/>

    <#include "../common/menu.ftl"/>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>移交管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/customerTransfer/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <label for="keyword" class="control-label">关键字：</label>
                    <input type="text" id="keyword" placeholder="请输入客户名" name="keyword" value="${qo.keyword!}">
                    <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询
                    </button>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>客户</th>
                            <th>旧销售</th>
                            <th>新销售</th>
                            <th>移交原因</th>
                            <th>操作时间</th>
                            <th>录入人</th>
                            <@shiro.hasAnyRoles name="Market_Manager,admin">
                                <th>操作</th>
                            </@shiro.hasAnyRoles>
                        </tr>
                        <#list pageInfo.list as ct>
                            <tr>
                                <td>${ct_index+1}</td>
                                <td>${(ct.customer.name)!}</td>
                                <td>${(ct.oldSeller.name)!}</td>
                                <td>${(ct.newSeller.name)!}</td>
                                <td>${(ct.reason)!}</td>
                                <td>${(ct.operateTime?string("yyyy-MM-dd"))!}</td>
                                <td>${(ct.operator.name)!}</td>
                                <@shiro.hasAnyRoles name="Market_Manager,admin">
                                    <td>
                                        <a href="#" id="editButton" data-dept='${(ct.json)!}'
                                           class="btn btn-info btn-xs btn-input">
                                            <span class="glyphicon glyphicon-pencil"></span> 编辑
                                        </a>
                                        <a href="#" data-id="${(ct.id)!}" class="btn btn-danger btn-xs btn-delete">
                                            <span class="glyphicon glyphicon-trash"></span> 删除
                                        </a>
                                    </td>
                                </@shiro.hasAnyRoles>

                            </tr>
                        </#list>
                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl"/>
                </div>
            </div>
        </section>
    </div>
    <#--<%@include file="/WEB-INF/views/common/footer.jsp"%>-->
    <#include "../common/footer.ftl"/>
</div>

<#---------------------模态框------------------------------->
<div class="modal fade " id="input-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">添加或编辑移交</h4>
            </div>
            <form class="form-horizontal" action="/customerTransfer/saveOrUpdate" method="post" id="editForm">
                <div class="modal-body">
                    <p>
                        <input type="hidden" id="id" name="id">

                    <div class="form-group" style="margin-top: 10px;">
                        <label for="name" class="col-sm-3 control-label">名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="name" name="name"
                                   placeholder="请输入移交名">
                        </div>
                    </div>

                    <div class="form-group" style="margin-top: 10px;">
                        <label for="sn" class="col-sm-3 control-label">编码：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="sn" name="sn"
                                   placeholder="请输入移交编码">
                        </div>
                    </div>
                    </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button id="submitBtn" type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>

</body>
</html>
